package com.e.library.http;

import java.util.Map;

import io.reactivex.Observable;
import retrofit2.http.Field;
import retrofit2.http.FieldMap;
import retrofit2.http.FormUrlEncoded;
import retrofit2.http.GET;
import retrofit2.http.POST;
import retrofit2.http.Path;
import retrofit2.http.QueryMap;

/**
 * http://wedo.111.xcrozz.com/
 * Created by lxy on 2016/8/22 15:59.
 * 注：大部分接口都是post,即使某个理应用get
 */
public interface EApi {

//    String BASE_URL = "http://wedo.111.xcrozz.com/";
    String BASE_URL = "http://merchant.wedo.my/";

    /**首页*/
    String INDEX_BANNER = "Index/indexBanner";          //广告banner
    String INDEX_BANNER_DETAIL = "Index/bannerDetail";  //广告详情
    String INDEX_RECOMMEND = "Index/recommendGoods";    //推荐商品
    String INDEX_FAVORABLE = "Index/favorableGoods";    //商品优惠
    String INDEX_AGENT = "Index/recommendAgent";        //推荐商家
    String INDEX_GOODS_CATEGORY = "Index/goodsCategory";//首页商品分类

    /**注册登录*/
    String LOGIN_LOGIN = "Login/login";                 //登录
    String LOGIN_REGISTER = "Login/register";           //注册
    String LOGIN_VERIFY_CODE = "Login/getVerifyCode";   //验证码
    String LOGIN_FORGOT_PASSWORD = "Login/forgetPassword";  //忘记密码
    String LOGIN_RESET_PASSWORD = "Login/resetPassword";    //重置密码
    String LOGIN_AUTH = "Login/thirdPartyLogin";        //第三方登录
    String LOGIN_BING = "Login/thirdPartyBinding";      //绑定账号

    /**商家*/
    String AGENT_COMPLETE = "Agent/completeAgent";//补充材料
    String AGENT_CATEGORY = "Category/agentCategory";//店铺类别
    String AGENT_NEARBY = "Agent/nearbyAgent";  //附近商家
    String AGENT_LIST = "Agent/agentList";      //店铺列表
    String AGENT_SEARCH = "Agent/searchAgent";  //搜索店铺
    String AGENT_DETAIL = "Agent/agentDetail";  //商家详情
    String AGENT_GOODS = "Agent/agentGoods";    //店铺商品
    String AGENT_INTRO = "Agent/agentDesc";     //店铺简介
    String AGENT_COMMENT = "Agent/agentGoodsComment";//店铺评价列表
    String AGENT_SEARCH_GOODS = "Agent/searchAgentGoods";//搜索店内商品
    String AGENT_RECOMMEND = "Agent/recommendAgent";//商家推荐

    /**商品*/
    String GOODS_DETAIL = "Goods/goodsDetail";//商品详情
    String GOODS_SKU = "Goods/getSkuAttr";//商品SKU
    String GOODS_LIST = "Goods/goodsList";//商品列表
    String GOODS_SEARCH = "Goods/searchGoods";//搜索商品
    String GOODS_RECOMMEND = "Goods/recommendGoods";//商品推荐

    /**购物车*/
    String SHOPPING_CAR = "Shop/shoppingCart";          //购物车
    String SHOPPING_CAR_ADD = "Shop/addShoppingCart";   //加入购物车
    String SHOPPING_CAR_DEL = "Shop/delShoppingCart";   //删除购物车
    String SHOPPING_COMMINT = "Shop/commitOrder";       //确认订单
    String SHOPPING_INFO = "Shop/orderInfo";            //订单结算
    String SHOPPING_EDIT = "Shop/editShoppingCart";     //编辑购物车

    /**评价*/
    String COMMENT_GOODS = "GoodsComment/goodsComment";

    /**图片上传*/
    String UPLOAD_IMG = "Public/photoUpload";
    /**客服电话*/
    String SERVICE_TEL = "Public/getServiceTel";

    /**收藏*/
    String COLLECT_TO = "Collect/toCollect";//添加收藏
    String COLLECT_MORE = "Collect/moreCollect";//多商品添加收藏
    String COLLECT_DEL = "Collect/delCollect";//删除收藏

    /**用户中心*/
    String USER_HISTORY = "Order/purchaseHistory";          //购买记录
    String USER_COLLECTGOODS = "Collect/collectGoods";      //我的收藏 商品
    String USER_COLLECTSHOPS = "Collect/collectAgent";      //我的收藏 店铺
    String USER_ADDRESSLIST = "Chat/addressList";           //通讯录
    String USER_MESSAGE = "Message/index";                  //消息
    String USER_AllCONSIGNEE="Consignee/userAllConsignee";  //我的地址簿
    String USER_ADDCONSIGNEE = "Consignee/addConsignee";    //增加地址
    String USER_FEEDBACK = "User/userFeedback";             //用户反馈
    String USER_INFO = "User/userInfo";                     //获取个人信息
    String USER_INDEX = "User/index";                       //个人中心首页
    String USER_RECHARGEAMOUNT = "Money/rechargeAmount";    //增值金额
    String USER_MONEYLOG = "Money/moneyLog";                //钱包收支明细
    String USER_POINTLOG = "Point/pointLog";                //积分明细
    String USER_POINTGOODS = "Point/pointGoods";            //积分商城商品
    String USER_POINTINFO = "Point/pointInfo";              //积分商品兑换页
    String USER_COMMITPOINTINFO = "Point/commitPointInfo";  //进行积分商品兑换
    String USER_POINTORDERDETAIL = "Point/orderDetail";     //兑换详情
    String USER_ORDERLIST = "Order/orderList";              //我的订单
    String USER_ORDERDETAIL = "Order/orderDetail";          //订单详情
    String USER_CANCELTHEORDER = "Order/cancelTheOrder";    //取消订单
    String USER_RECEIVED = "Order/received";                //订单确认收货
    String USER_GOODSCOMMENT = "GoodsComment/addGoodsComment";//商品评价
    String USER_ATTENTION = "User/toAttention";             //关注店铺
    String USER_UPDATEUSER = "User/updateUser";             //个人资料设置
    String USER_DELCOLLECT = "Collect/delCollect";          //删除收藏
    String USER_SHAREPOINTLOG = "Point/sharePointLog";      //推荐有奖积分明细
    String USER_ORDERMESSAGE = "Message/orderMessage";      //订单消息
    String USER_SYSTEMMESSAGE = "Message/systemMessage";    //系统消息
    String USER_MESSAGEDETAIL = "Message/messageDetail";     //消息详情
    String USER_RESETPASSWORD = "Login/resetPassword";      //修改密码
    String USER_REGION = "Region/getRegion";                //获取省列表接口
    String USER_CHILDZONE = "Region/getChildZone";          //得到下级地区接口
    String USER_DEFAULT = "Consignee/setToDefault";         //设置为默认地址
    String USER_DELCONSIGNES = "Consignee/delConsignee";    //删除地址
    String USER_COMMITORDER = "Money/commitOrder";          //充值下单接口
    String USER_RECHARGEMONEY = "Money/rechargeMoney";      //充值成功接口
    String USER_VERIFYPAYPASSWORD = "User/verifyPayPassword";//验证支付密码
    String USER_EDITPAYPASSWORD = "User/editPayPassword";    //修改支付密码
    String USER_SHARECALLBACK = "Point/shareCallback";      //推荐有奖分享成功回调
    String USER_CHOOSELANGUAGE = "User/chooseLanguage";           //选择语言



    /**Article*/
    String ARTICLE_DETAIL = "Article/articleDetail";

    /**支付*/
    String PAYMENT_PAYPAL = "Paypal/clientToken";           //获取PayPal token
    String PAYMENT_NOTIF = "Paypal/processorSettlementResponse";//支付成功，通知服务器

    String MONEY_SWEEP_TO_PAY = "Money/sweepTheCodeToPay";//扫码支付
    String MONEY_BALANCE_PAY = "Money/balancePaid";//余额支付

    String PAYMENT_IPAY88 = "Pay/ipay88";//订单支付
    String PAYMENT_IPAY88_SCAN = "Pay/ipay88ScanCode";//iPay88 扫码支付

    /**save chat*/
    String CHAT_SAVE = "Chat/saveChat";

    /**
     * post
     * @param url
     * @param params
     * @return
     */
    @FormUrlEncoded
    @POST("{url}")
    Observable<EResponse> post(@Path(value = "url", encoded = true) String url, @FieldMap(encoded = true) Map<String, String> params);

    /**
     * get
     * @param url
     * @param params
     * @return
     */
    @GET("{url}")
    Observable<EResponse> get(@Path(value = "url", encoded = true) String url, @QueryMap(encoded = true) Map<String, String> params);

    /**
     * get
     * @param url
     * @return
     */
    @GET("{url}")
    Observable<EResponse> get(@Path(value = "url", encoded = true) String url);

    @FormUrlEncoded
    @POST(INDEX_BANNER_DETAIL)
    Observable<EResponse> bannerDetail(@Field("id") String id);

    @FormUrlEncoded
    @POST(INDEX_AGENT)
    Observable<EResponse> agent(@Field("longitude") String lng,@Field("latitude") String lat);

    @FormUrlEncoded
    @POST(INDEX_AGENT)
    Observable<EResponse> agent(@FieldMap(encoded = true) Map<String, String> params);

    @FormUrlEncoded
    @POST(AGENT_DETAIL)
    Observable<EResponse> agentDetail(@Field("id") String id);

    @FormUrlEncoded
    @POST(LOGIN_LOGIN)
    Observable<EResponse> login(@Field("account") String account,@Field("password") String password);

    @FormUrlEncoded
    @POST(LOGIN_AUTH)
    Observable<EResponse> auth(@FieldMap(encoded = true) Map<String,String> params);

    /**
     * 获取验证码
     * @param account
     * @param type 验证码类型（0：注册，1：忘记密码，2：修改密码）
     * @return
     */
    @FormUrlEncoded
    @POST(LOGIN_VERIFY_CODE)
    Observable<EResponse> verifyCode(@Field("account") String account,@Field("type") String type);

    /***
     * 图片上传
     * @param image 图片(base64格式)
     * @param dir Agent：商家，Comment：商品评论
     * @return
     */
    @FormUrlEncoded
    @POST(UPLOAD_IMG)
    Observable<EResponse> upload(@Field("image") String image,@Field("dir") String dir);

    @FormUrlEncoded
    @POST(COLLECT_TO)
    Observable<EResponse> collect(@Field("id") String id,@Field("type") String type);

    @FormUrlEncoded
    @POST(COLLECT_MORE)
    Observable<EResponse> moreCollect(@Field("ids") String ids);

    @FormUrlEncoded
    @POST(COLLECT_DEL)
    Observable<EResponse> delCollect(@Field("ids") String id);

    /**
     * 加入购物车
     * @param goods_id
     * @param goods_number
     * @param is_buy 默认为0，加入购物车，1为立即购买
     * @return
     */
    @FormUrlEncoded
    @POST(SHOPPING_CAR_ADD)
    Observable<EResponse> addShoppingCar(@Field("goods_id") String goods_id,@Field("goods_number") String goods_number,@Field("is_buy") String is_buy);

    /**
     * 删除购物车
     * @param id 多个商品id以逗号分隔
     * @return
     */
    @FormUrlEncoded
    @POST(SHOPPING_CAR_DEL)
    Observable<EResponse> delShoppingCar(@Field("id") String id);

    /**
     *
     * @param id 购物车ID
     * @param goods_number
     * @param goods_id 商品id（更改商品属性时必需）
     * @return
     */
    @FormUrlEncoded
    @POST(SHOPPING_EDIT)
    Observable<EResponse> editShoppingCar(@Field("id") String id,@Field("goods_number") String goods_number,@Field("goods_id") String goods_id);

    /***
     * 获取文章单页内容
     * @param sign share：推荐有奖
    agreement：用户协议
    aboutUs：关于我们
     * @return
     */
    @FormUrlEncoded
    @POST(ARTICLE_DETAIL)
    Observable<EResponse> article(@Field("sign") String sign);

    /**
     * 客服电话
     * @param params
     * @return
     */
    @FormUrlEncoded
    @POST(SERVICE_TEL)
    Observable<EResponse> tel(@FieldMap(encoded = true) Map<String, String> params);

}
